{{ define "list/member-list.html" }}
<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="/static/sweetalert/ions_alert.js"></script>
    <script src="/static/sweetalert/sweetalert.min.js"></script>
    <link rel="stylesheet" href="/static/sweetalert/sweetalert.css">
  </head>
  
  <body>
    <div class="x-nav">
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>

    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
          <div class="xing">姓名:{{.list.Realname}}</div>
          <div class="time"> 最后一次登录时间：{{.list.LastLoginDate}}</div>
<!--          <input class="layui-input" placeholder="开始日" name="start" id="start">-->
<!--          <input class="layui-input" placeholder="截止日" name="end" id="end">-->
<!--          <input type="text" name="username"  placeholder="请输入用户名" autocomplete="off" class="layui-input">-->
        </form>
      </div>
      <xblock>
        <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>退出登錄</button>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>学号</th>
            <th>课程名称</th>
            <th>任课老师</th>
            <th>课程代号</th>
            <th>访问课程次数</th>
            <th>课程学习时间</th>
            <th>状态</th>
            <th>操作</th></tr>

        </thead>
        <tbody>

        {{range .test}}
        <tr>
          <td>
            <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id="{{.Id}}"><i class="layui-icon">&#xe605;</i></div>
          </td>
          <td>{{.Username}}</td>
          <td>{{.Coursename}}</td>
          <td>{{.Realname}}</td>
          <td>{{.Order1}}</td>
          <td>{{.EnterCount}}</td>
          <td>{{.InLessonTime}}</td>
          <td class="td-status">
            <input type="hidden" class="is_active_val" value="{{.Js}}">
            {{if eq .Js 1}}
            <span class="layui-btn layui-btn-normal layui-btn-mini">正在刷课中...</span></td>
            {{else if eq .Js 0}}
          <span class="layui-btn layui-btn-danger layui-btn-mini">已停用</span></td>

          {{end}}
          <td class="td-manage">
            {{if eq .Js 1}}
            <a class="wdr" onclick="member_stop12(this,'{{.Username}}','{{.Id}}','{{.Order1}}')" href="javascript:;"  title="停用">
              <i class="layui-icon">&#xe601;</i>
            </a>
          {{else if eq .Js 0}}
            <a class="wdr" onclick="member_stop12(this,'{{.Username}}','{{.Id}}','{{.Order1}}')" href="javascript:;"  title="启用">
<!--            <a class="wdr" onclick="member_stop(this,'{{.Id}}')" href="javascript:;"  title="启用">-->
              <i class="layui-icon">&#xe62f;</i>
            </a>
          {{end}}
            &ensp;功能开发中...
<!--            <a title="编辑"  onclick="x_admin_show('编辑','',600,400)" href="javascript:;">-->
<!--              <i class="layui-icon">&#xe642;</i>-->
<!--            </a>-->
<!--            <a onclick="x_admin_show('修改密码','member-password.html',600,400)" title="修改密码" href="javascript:;">-->
<!--              <i class="layui-icon">&#xe631;</i>-->
<!--            </a>-->
<!--            <a title="删除" onclick="member_del(this,'')" href="javascript:;">-->
<!--              <i class="layui-icon">&#xe640;</i>-->
<!--            </a>-->
          </td>
        </tr>

        {{end}}

        </tbody>
      </table>

    </div>
    <script>
      // $windowObj  = null;
      // var loop = setInterval(function() {
      //   if($windowObj  != null && $windowObj.closed) {
      //     clearInterval(loop);
      //     //do something 在这里执行回调
      //   }
      // }, 800);
      layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });
       /*用户-启用停用*/
        function member_stop12(obj,id,ids,Order1){
        var is_val12 = $(obj).parent().prev().children("input").val();
        if (is_val12 ==1){
          layer.confirm('确认要停用吗？',function(index){
            layer.close(index);
            $.ajax({
              url:"/start",
              type:"POST",
              data:{
                "is_val_wdr":is_val12,
                "id":id,
                "ids":ids,
                "Order1":Order1
              },
              success:function (data) {
                ions_alert.alertSuccessToast(data["msg"]);
                setTimeout(reload_list,1000)
              },
              fail:function (data) {
                ions_alert.alertErrorToast("状态修改失败")
              }
            })

          });
        }else {
          layer.confirm('确认要启用吗？',function(index){
            layer.close(index);
            $.ajax({
              url:"/start",
              type:"POST",
              data:{
                "is_val_wdr":is_val12,
                "id":id,
                "ids":ids,
                "Order1":Order1
              }
              ,
              success:function (data) {
                ions_alert.alertSuccessToast(data["msg"]);
                setTimeout(reload_list,1000)
              },
              fail:function (data) {
                ions_alert.alertErrorToast("状态修改失败")
              }
            })

          });
        }

        }

      function reload_list() {
        window.location.href="/list"
      }
      $(function  () {
        layui.use('form', function () {
          var form = layui.form;
          //监听提交
          form.on('submit(sreach)', function (data) {
            $.ajax({
              url:"/main/user/start",
              type:"POST",
              data:{},
              success:function (data) {
                var code = data["code"];
                if(code == 200){
                  ions_alert.alertSuccessToast(data["msg"]);
                  window.location.href="/"
                }else {
                  ions_alert.alertErrorToast(  data["msg"])
                }
              },
              fail:function (data) {
                alert(data)
              }
            });
            return false;
          });


        });
      });



      function delAll (argument) {
        $.ajax({
          url:"/exit",
          type:"POST",
          data:{},
          success:function (data) {
            var code = data["code"];
            if(code == 200){
              ions_alert.alertSuccessToast(data["msg"]);
              window.location.href="/"
            }else {
              ions_alert.alertErrorToast(data["msg"])
              window.location.href="/"
            }
          },
          fail:function (data) {
            alert(data)
          }
        })

      }
    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();</script>
  </body>

</html>
{{end}}